package com.ke.forum.forumapi.service.impl;

import com.ke.forum.common.common.Result;
import com.ke.forum.mbg.entity.Section;
import com.ke.forum.mbg.dao.SectionMapper;
import com.ke.forum.forumapi.service.SectionService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ke.forum.mbg.entity.dto.UserDto;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 珂
 * @since 2021-05-22
 */
@Service
public class SectionServiceImpl extends ServiceImpl<SectionMapper, Section> implements SectionService {

    @Autowired
    SectionMapper sectionMapper;

    @Override
    public Result listMyStarSection() {
        UserDto userDto = (UserDto) SecurityUtils.getSubject().getPrincipal();
        List<Section> sections = sectionMapper.listMyStarSection(userDto.getUuid());
        return Result.SUCCESS(sections);
    }
}
